home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /************************************************************
-
- Shapes Library
-
- All shapes are available in both wire frame and filled
- (that is, polygonized with normals).
-
- Calls for wire frame shapes begin with the letter 'w'. Calls
- for filled shapes begin with the letter 'f'.
-
- Available shapes are:
-
- Wire Frame Filled Default Size Origin
- ---------- ------ ------------ ------
- wletterf() fletterf() h = 1.0, d = 1.0 center of solid
- wtetra() ftetra() b = 1.0, h = 1.0 center of solid
- wcube() fcube() unit center of solid
- wbeam() fbeam() x = 1.0, y = 0.2, center of left side
- z = 0.5
- wocta() focta() unit center of solid
- wdodeca() fdodeca() unit center of solid
- wicosa() ficosa() unit center of solid
- wcone() fcone() h = 1.0, r_base = 1.0 center of base
- wcylinder() fcylinder() l = 1.0, r = 1.0 center of solid
- fclocylinder()l = 1.0, r = 1.0 center of solid
- wtorus() ftorus() r_cross_section = .3 center of solid
- r_torus = 1.0
- wsphere() fsphere() r = 1.0 center of solid
- whemisphere() fhemisphere() r = 1.0 center of solid
-
- axes() unit origin of axes
- beachball(c1,c2) r = 1.0, stripes = 12 center of solid
-
-
- Changing shape defaults:
- Certain shapes may have their default sizes changed by calling a
- setup routine. This routine only needs to be called once.
-
- setcube(float x, float y, float z);
- setbeam(float x, float y, float z);
- settorus(float rad_cross_section, float radius_torus);
- setbeachball(int num_stripes);
-
- The platonic solids are defined as follows:
-
- name edges per facet facets vertices edges
- ---- --------------- ------ -------- -----
- tetra 3 4 4 6
- cube 4 6 8 12
- octa 3 8 6 12
- dodeca 5 12 20 30
- icoso 3 20 12 30
-
- The beachball takes two colors which are used for the alternating
- vertical stripes. In RGB mode, the colors are interpreted as cpack
- values (of the form 0xAABBGGRR); in color map mode the colors are
- interpreted as colormap indices.
-
- Bug:
- For the cube, beam and torus, only one size may be active at one time.
- That is, everytime you call settorus, you change the shape of any torii
- you are currently displaying.
-
- Commercial:
- This shapes library is brought to you by the letter f.
- ************************************************************/
-
- #include <gl/gl.h>
- #include <gl/get.h>
- #include <gl/sphere.h>
- #include <math.h>
- #include "shapes.h"
-
- /* three dimensional vector */
- typedef float vector[3];
-
- /* useful vectors for the cube, beam, letter f and axes */
- static vector front = { 0.0, 0.0, 1.0};
- static vector back = { 0.0, 0.0, -1.0};
- static vector top = { 0.0, 1.0, 0.0};
- static vector bottom = { 0.0, -1.0, 0.0};
- static vector right = { 1.0, 0.0, 0.0};
- static vector left = {-1.0, 0.0, 0.0};
- static vector center = { 0.0, 0.0, 0.0};
-
-
- /************************************************************
- LETTER F
- ************************************************************/
-
- /* default size for the letter f */
- #define F_SIZE 1.0
- #define F_DEPTH 1.0
-
- /* array of letter f vertices */
- static vector f_point[20];
-
- /* has the letter f been initialized */
- static Boolean letterf_initialized = FALSE;
-
- /* initialize the letter f vertices */
- static void initletterf(void)
- {
- float size = F_SIZE, depth = F_DEPTH;
- int i;
-
- f_point[0][0] = f_point[10][0] = -0.3 * size;
- f_point[0][1] = f_point[10][1] = -0.5 * size;
- f_point[1][0] = f_point[11][0] = -0.3 * size;
- f_point[1][1] = f_point[11][1] = 0.5 * size;
- f_point[2][0] = f_point[12][0] = 0.3 * size;
- f_point[2][1] = f_point[12][1] = 0.5 * size;
- f_point[3][0] = f_point[13][0] = 0.3 * size;
- f_point[3][1] = f_point[13][1] = 0.3 * size;
- f_point[4][0] = f_point[14][0] = -0.1 * size;
- f_point[4][1] = f_point[14][1] = 0.3 * size;
- f_point[5][0] = f_point[15][0] = -0.1 * size;
- f_point[5][1] = f_point[15][1] = 0.1 * size;
- f_point[6][0] = f_point[16][0] = 0.1 * size;
- f_point[6][1] = f_point[16][1] = 0.1 * size;
- f_point[7][0] = f_point[17][0] = 0.1 * size;
- f_point[7][1] = f_point[17][1] = -0.1 * size;
- f_point[8][0] = f_point[18][0] = -0.1 * size;
- f_point[8][1] = f_point[18][1] = -0.1 * size;
- f_point[9][0] = f_point[19][0] = -0.1 * size;
- f_point[9][1] = f_point[19][1] = -0.5 * size;
-
- /* store z coordinates for vertices */
- for (i = 0; i < 10; i++)
- {
- f_point[i][2] = depth/2.0;
- f_point[i+10][2] = -depth/2.0;
- }
-
- letterf_initialized = TRUE;
- }
-
-
- /* wireframe letter f */
- void wletterf(void)
- {
- int i;
-
- if (! letterf_initialized)
- initletterf();
-
- /* draw front closedline */
- bgnclosedline();
- v3f(f_point[9]);
- v3f(f_point[8]);
- v3f(f_point[7]);
- v3f(f_point[6]);
- v3f(f_point[5]);
- v3f(f_point[4]);
- v3f(f_point[3]);
- v3f(f_point[2]);
- v3f(f_point[1]);
- v3f(f_point[0]);
- endclosedline();
-
- /* draw back closedline */
- bgnclosedline();
- v3f(f_point[10]);
- v3f(f_point[11]);
- v3f(f_point[12]);
- v3f(f_point[13]);
- v3f(f_point[14]);
- v3f(f_point[15]);
- v3f(f_point[16]);
- v3f(f_point[17]);
- v3f(f_point[18]);
- v3f(f_point[19]);
- endclosedline();
-
- /* draw first nine connecting closedlines */
- for (i = 0; i < 9; i++)
- {
- bgnclosedline();
- v3f(f_point[i+1]);
- v3f(f_point[i+11]);
- v3f(f_point[i+10]);
- v3f(f_point[i]);
- endclosedline();
- }
-
- /* draw closed line at very bottom */
- bgnclosedline();
- v3f(f_point[0]);
- v3f(f_point[10]);
- v3f(f_point[19]);
- v3f(f_point[9]);
- endclosedline();
-
- }
-
-
- /* filled letter f */
- void fletterf(void)
- {
- if (! letterf_initialized)
- initletterf();
-
- /* draw front face decomposed into convex polygons */
- bgnpolygon();
- n3f(front);
- v3f(f_point[0]);
- v3f(f_point[9]);
- v3f(f_point[4]);
- v3f(f_point[1]);
- endpolygon();
- bgnpolygon();
- n3f(front);
- v3f(f_point[1]);
- v3f(f_point[4]);
- v3f(f_point[3]);
- v3f(f_point[2]);
- endpolygon();
- bgnpolygon();
- n3f(front);
- v3f(f_point[1]);
- v3f(f_point[4]);
- v3f(f_point[3]);
- v3f(f_point[2]);
- endpolygon();
- bgnpolygon();
- n3f(front);
- v3f(f_point[8]);
- v3f(f_point[7]);
- v3f(f_point[6]);
- v3f(f_point[5]);
- endpolygon();
-
- /* draw back face decomposed into convex polygons */
- bgnpolygon();
- n3f(back);
- v3f(f_point[11]);
- v3f(f_point[14]);
- v3f(f_point[19]);
- v3f(f_point[10]);
- endpolygon();
- bgnpolygon();
- n3f(back);
- v3f(f_point[12]);
- v3f(f_point[13]);
- v3f(f_point[14]);
- v3f(f_point[11]);
- endpolygon();
- bgnpolygon();
- n3f(back);
- v3f(f_point[12]);
- v3f(f_point[13]);
- v3f(f_point[14]);
- v3f(f_point[11]);
- endpolygon();
- bgnpolygon();
- n3f(back);
- v3f(f_point[15]);
- v3f(f_point[16]);
- v3f(f_point[17]);
- v3f(f_point[18]);
- endpolygon();
-
- /* draw sides */
-
- bgnpolygon();
- n3f(bottom);
- v3f(f_point[0]);
- v3f(f_point[10]);
- v3f(f_point[19]);
- v3f(f_point[9]);
- endpolygon();
-
- bgnpolygon();
- n3f(left);
- v3f(f_point[0]);
- v3f(f_point[1]);
- v3f(f_point[11]);
- v3f(f_point[10]);
- endpolygon();
-
- bgnpolygon();
- n3f(top);
- v3f(f_point[1]);
- v3f(f_point[2]);
- v3f(f_point[12]);
- v3f(f_point[11]);
- endpolygon();
-
- bgnpolygon();
- n3f(right);
- v3f(f_point[2]);
- v3f(f_point[3]);
- v3f(f_point[13]);
- v3f(f_point[12]);
- endpolygon();
-
- bgnpolygon();
- n3f(bottom);
- v3f(f_point[3]);
- v3f(f_point[4]);
- v3f(f_point[14]);
- v3f(f_point[13]);
- endpolygon();
-
- bgnpolygon();
- n3f(right);
- v3f(f_point[4]);
- v3f(f_point[5]);
- v3f(f_point[15]);
- v3f(f_point[14]);
- endpolygon();
-
- bgnpolygon();
- n3f(top);
- v3f(f_point[5]);
- v3f(f_point[6]);
- v3f(f_point[16]);
- v3f(f_point[15]);
- endpolygon();
-
- bgnpolygon();
- n3f(right);
- v3f(f_point[6]);
- v3f(f_point[7]);
- v3f(f_point[17]);
- v3f(f_point[16]);
- endpolygon();
-
- bgnpolygon();
- n3f(bottom);
- v3f(f_point[7]);
- v3f(f_point[8]);
- v3f(f_point[18]);
- v3f(f_point[17]);
- endpolygon();
-
- bgnpolygon();
- n3f(right);
- v3f(f_point[8]);
- v3f(f_point[9]);
- v3f(f_point[19]);
- v3f(f_point[18]);
- endpolygon();
- }
-
-
- /************************************************************
- CUBE
- ************************************************************/
-
- /* default cube size */
- #define CUBE_X 1.0
- #define CUBE_Y 1.0
- #define CUBE_Z 1.0
-
- /* array for cube vertices */
- static vector cube_point[8];
-
- /* has the cube been initialized */
- static Boolean cube_initialized = FALSE;
-
- void setcube(float x, float y, float z)
- {
- cube_point[1][0] = cube_point[2][0] =
- cube_point[5][0] = cube_point[6][0] = x/2.0;
-
- cube_point[0][0] = cube_point[3][0] =
- cube_point[4][0] = cube_point[7][0] = -x/2.0;
-
- cube_point[2][1] = cube_point[3][1] =
- cube_point[6][1] = cube_point[7][1] = y/2.0;
-
- cube_point[0][1] = cube_point[1][1] =
- cube_point[4][1] = cube_point[5][1] = -y/2.0;
-
- cube_point[0][2] = cube_point[1][2] =
- cube_point[2][2] = cube_point[3][2] = z/2.0;
-
- cube_point[4][2] = cube_point[5][2] =
- cube_point[6][2] = cube_point[7][2] = -z/2.0;
-
- cube_initialized = TRUE;
- }
-
-
- /* wireframe cube */
- void wcube(void)
- {
- if (! cube_initialized)
- setcube(CUBE_X, CUBE_Y, CUBE_Z);
-
- /* draw bottom facing closedline */
- bgnclosedline();
- v3f(cube_point[4]);
- v3f(cube_point[5]);
- v3f(cube_point[1]);
- v3f(cube_point[0]);
- endclosedline();
-
- /* draw left facing closedline */
- bgnclosedline();
- v3f(cube_point[3]);
- v3f(cube_point[7]);
- v3f(cube_point[4]);
- v3f(cube_point[0]);
- endclosedline();
-
- /* draw right facing closedline */
- bgnclosedline();
- v3f(cube_point[5]);
- v3f(cube_point[6]);
- v3f(cube_point[2]);
- v3f(cube_point[1]);
- endclosedline();
-
- /* draw top facing closedline */
- bgnclosedline();
- v3f(cube_point[6]);
- v3f(cube_point[7]);
- v3f(cube_point[3]);
- v3f(cube_point[2]);
- endclosedline();
-
- /* draw front facing closedline */
- bgnclosedline();
- v3f(cube_point[1]);
- v3f(cube_point[2]);
- v3f(cube_point[3]);
- v3f(cube_point[0]);
- endclosedline();
-
- /* draw back facing closedline */
- bgnclosedline();
- v3f(cube_point[6]);
- v3f(cube_point[5]);
- v3f(cube_point[4]);
- v3f(cube_point[7]);
- endclosedline();
- }
-
-
- /* filled cube */
- void fcube(void)
- {
- if (! cube_initialized)
- setcube(CUBE_X, CUBE_Y, CUBE_Z);
-
- /* draw bottom facing polygon */
- bgnpolygon();
- n3f(bottom);
- v3f(cube_point[4]);
- v3f(cube_point[5]);
- v3f(cube_point[1]);
- v3f(cube_point[0]);
- endpolygon();
-
- /* draw left facing polygon */
- bgnpolygon();
- n3f(left);
- v3f(cube_point[3]);
- v3f(cube_point[7]);
- v3f(cube_point[4]);
- v3f(cube_point[0]);
- endpolygon();
-
- /* draw right facing polygon */
- bgnpolygon();
- n3f(right);
- v3f(cube_point[5]);
- v3f(cube_point[6]);
- v3f(cube_point[2]);
- v3f(cube_point[1]);
- endpolygon();
-
- /* draw top facing polygon */
- bgnpolygon();
- n3f(top);
- v3f(cube_point[6]);
- v3f(cube_point[7]);
- v3f(cube_point[3]);
- v3f(cube_point[2]);
- endpolygon();
-
- /* draw front facing polygon */
- bgnpolygon();
- n3f(front);
- v3f(cube_point[1]);
- v3f(cube_point[2]);
- v3f(cube_point[3]);
- v3f(cube_point[0]);
- endpolygon();
-
- /* draw back facing polygon */
- bgnpolygon();
- n3f(back);
- v3f(cube_point[6]);
- v3f(cube_point[5]);
- v3f(cube_point[4]);
- v3f(cube_point[7]);
- endpolygon();
- }
-
-
- /************************************************************
- BEAM
- ************************************************************/
-
- /* default beam size */
- #define BEAM_X 1.0
- #define BEAM_Y 0.2
- #define BEAM_Z 0.5
-
- /* array for beam vertices */
- static vector beam_point[8];
-
- /* has the beam been initialized */
- static Boolean beam_initialized = FALSE;
-
-
- void setbeam(float x, float y, float z)
- {
- beam_point[1][0] = beam_point[2][0] =
- beam_point[5][0] = beam_point[6][0] = x;
-
- beam_point[0][0] = beam_point[3][0] =
- beam_point[4][0] = beam_point[7][0] = 0.0;
-
- beam_point[2][1] = beam_point[3][1] =
- beam_point[6][1] = beam_point[7][1] = y/2.0;
-
- beam_point[0][1] = beam_point[1][1] =
- beam_point[4][1] = beam_point[5][1] = -y/2.0;
-
- beam_point[0][2] = beam_point[1][2] =
- beam_point[2][2] = beam_point[3][2] = z/2.0;
-
- beam_point[4][2] = beam_point[5][2] =
- beam_point[6][2] = beam_point[7][2] = -z/2.0;
-
- beam_initialized = TRUE;
- }
-
-
- /* wireframe beam */
- void wbeam(void)
- {
- if (! beam_initialized)
- setbeam(BEAM_X, BEAM_Y, BEAM_Z);
-
- /* draw bottom facing closedline */
- bgnclosedline();
- v3f(beam_point[4]);
- v3f(beam_point[5]);
- v3f(beam_point[1]);
- v3f(beam_point[0]);
- endclosedline();
-
- /* draw left facing closedline */
- bgnclosedline();
- v3f(beam_point[3]);
- v3f(beam_point[7]);
- v3f(beam_point[4]);
- v3f(beam_point[0]);
- endclosedline();
-
- /* draw right facing closedline */
- bgnclosedline();
- v3f(beam_point[5]);
- v3f(beam_point[6]);
- v3f(beam_point[2]);
- v3f(beam_point[1]);
- endclosedline();
-
- /* draw top facing closedline */
- bgnclosedline();
- v3f(beam_point[6]);
- v3f(beam_point[7]);
- v3f(beam_point[3]);
- v3f(beam_point[2]);
- endclosedline();
-
- /* draw front facing closedline */
- bgnclosedline();
- v3f(beam_point[1]);
- v3f(beam_point[2]);
- v3f(beam_point[3]);
- v3f(beam_point[0]);
- endclosedline();
-
- /* draw back facing closedline */
- bgnclosedline();
- v3f(beam_point[6]);
- v3f(beam_point[5]);
- v3f(beam_point[4]);
- v3f(beam_point[7]);
- endclosedline();
- }
-
-
- /* filled beam */
- void fbeam(void)
- {
- if (! beam_initialized)
- setbeam(BEAM_X, BEAM_Y, BEAM_Z);
-
- /* draw bottom facing polygon */
- bgnpolygon();
- n3f(bottom);
- v3f(beam_point[4]);
- v3f(beam_point[5]);
- v3f(beam_point[1]);
- v3f(beam_point[0]);
- endpolygon();
-
- /* draw left facing polygon */
- bgnpolygon();
- n3f(left);
- v3f(beam_point[3]);
- v3f(beam_point[7]);
- v3f(beam_point[4]);
- v3f(beam_point[0]);
- endpolygon();
-
- /* draw right facing polygon */
- bgnpolygon();
- n3f(right);
- v3f(beam_point[5]);
- v3f(beam_point[6]);
- v3f(beam_point[2]);
- v3f(beam_point[1]);
- endpolygon();
-
- /* draw top facing polygon */
- bgnpolygon();
- n3f(top);
- v3f(beam_point[6]);
- v3f(beam_point[7]);
- v3f(beam_point[3]);
- v3f(beam_point[2]);
- endpolygon();
-
- /* draw front facing polygon */
- bgnpolygon();
- n3f(front);
- v3f(beam_point[1]);
- v3f(beam_point[2]);
- v3f(beam_point[3]);
- v3f(beam_point[0]);
- endpolygon();
-
- /* draw back facing polygon */
- bgnpolygon();
- n3f(back);
- v3f(beam_point[6]);
- v3f(beam_point[5]);
- v3f(beam_point[4]);
- v3f(beam_point[7]);
- endpolygon();
- }
-
-
- /************************************************************
- TETRAHEDRON
- ************************************************************/
-
- /* default tetrahedron size */
- #define TETRA_BASE 1.0
- #define TETRA_HEIGHT 1.0
-
- /* arrays for tetrahedron vertices and normals */
- static vector tetra_point[4];
- static vector tetra_norm[4];
-
- /* has the tetrahedron been initialized yet */
- static Boolean tetra_initialized = FALSE;
-
- static void inittetra(void)
- {
- float b = TETRA_BASE, h = TETRA_HEIGHT;
-
- tetra_point[0][0] = 0.0;
- tetra_point[0][1] = -h/2.0;
- tetra_point[0][2] = b/fsqrt(3.0);
- tetra_point[1][0] = -b/2.0;
- tetra_point[1][1] = -h/2.0;
- tetra_point[1][2] = -b/(2.0*fsqrt(3.0));
- tetra_point[2][0] = b/2.0;
- tetra_point[2][1] = -h/2.0;
- tetra_point[2][2] = -b/(2.0*fsqrt(3.0));
- tetra_point[3][0] = 0.0;
- tetra_point[3][1] = h/2.0;
- tetra_point[3][2] = 0.0;
-
- tetra_norm[0][0] = 0.0;
- tetra_norm[0][1] = h/2.0;
- tetra_norm[0][2] = -b/fsqrt(3.0);
- tetra_norm[1][0] = b/2.0;
- tetra_norm[1][1] = h/2.0;
- tetra_norm[1][2] = b/(2.0*fsqrt(3.0));
- tetra_norm[2][0] = -b/2.0;
- tetra_norm[2][1] = h/2.0;
- tetra_norm[2][2] = b/(2.0*fsqrt(3.0));
- tetra_norm[3][0] = 0.0;
- tetra_norm[3][1] = -h/2.0;
- tetra_norm[3][2] = 0.0;
-
- tetra_initialized = TRUE;
- }
-
-
- /* wireframe tetrahedron */
- void wtetra(void)
- {
- if (! tetra_initialized)
- inittetra();
-
- bgnclosedline();
- v3f(tetra_point[0]);
- v3f(tetra_point[1]);
- v3f(tetra_point[2]);
- endclosedline();
-
- bgnclosedline();
- v3f(tetra_point[0]);
- v3f(tetra_point[3]);
- v3f(tetra_point[1]);
- endclosedline();
-
- bgnclosedline();
- v3f(tetra_point[0]);
- v3f(tetra_point[2]);
- v3f(tetra_point[3]);
- endclosedline();
-
- bgnclosedline();
- v3f(tetra_point[1]);
- v3f(tetra_point[3]);
- v3f(tetra_point[2]);
- endclosedline();
- }
-
-
- /* filled tetrahedron */
- void ftetra(void)
- {
- if (! tetra_initialized)
- inittetra();
-
- bgnpolygon();
- n3f(tetra_norm[3]);
- v3f(tetra_point[0]);
- v3f(tetra_point[1]);
- v3f(tetra_point[2]);
- endpolygon();
-
- bgnpolygon();
- n3f(tetra_norm[2]);
- v3f(tetra_point[0]);
- v3f(tetra_point[3]);
- v3f(tetra_point[1]);
- endpolygon();
-
- bgnpolygon();
- n3f(tetra_norm[1]);
- v3f(tetra_point[0]);
- v3f(tetra_point[2]);
- v3f(tetra_point[3]);
- endpolygon();
-
- bgnpolygon();
- n3f(tetra_norm[0]);
- v3f(tetra_point[1]);
- v3f(tetra_point[3]);
- v3f(tetra_point[2]);
- endpolygon();
- }
-
-
- /************************************************************
- OCTAHEDRON
- ************************************************************/
-
- #define ONE_OVER_SQRT3 0.57735
-
- /* unit vectors for the octahedron */
- static vector oct_ppp = { ONE_OVER_SQRT3, ONE_OVER_SQRT3, ONE_OVER_SQRT3};
- static vector oct_npp = {-ONE_OVER_SQRT3, ONE_OVER_SQRT3, ONE_OVER_SQRT3};
- static vector oct_pnp = { ONE_OVER_SQRT3,-ONE_OVER_SQRT3, ONE_OVER_SQRT3};
- static vector oct_nnp = {-ONE_OVER_SQRT3,-ONE_OVER_SQRT3, ONE_OVER_SQRT3};
- static vector oct_ppn = { ONE_OVER_SQRT3, ONE_OVER_SQRT3,-ONE_OVER_SQRT3};
- static vector oct_npn = {-ONE_OVER_SQRT3, ONE_OVER_SQRT3,-ONE_OVER_SQRT3};
- static vector oct_pnn = { ONE_OVER_SQRT3,-ONE_OVER_SQRT3,-ONE_OVER_SQRT3};
- static vector oct_nnn = {-ONE_OVER_SQRT3,-ONE_OVER_SQRT3,-ONE_OVER_SQRT3};
-
- /* wireframe octahedron */
- void wocta(void)
- {
- bgnclosedline();
- v3f(top);
- v3f(back);
- v3f(bottom);
- v3f(front);
- endclosedline();
-
- bgnclosedline();
- v3f(top);
- v3f(right);
- v3f(bottom);
- v3f(left);
- endclosedline();
-
- bgnclosedline();
- v3f(right);
- v3f(top);
- v3f(left);
- v3f(bottom);
- endclosedline();
-
- bgnclosedline();
- v3f(right);
- v3f(back);
- v3f(left);
- v3f(front);
- endclosedline();
- }
-
-
- /* filled octahedron */
- void focta(void)
- {
- bgnpolygon();
- n3f(oct_ppp);
- v3f(front);
- v3f(right);
- v3f(top);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_npp);
- v3f(left);
- v3f(front);
- v3f(top);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_pnp);
- v3f(right);
- v3f(front);
- v3f(bottom);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_nnp);
- v3f(left);
- v3f(bottom);
- v3f(front);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_ppn);
- v3f(top);
- v3f(right);
- v3f(back);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_npn);
- v3f(top);
- v3f(back);
- v3f(left);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_pnn);
- v3f(right);
- v3f(bottom);
- v3f(back);
- endpolygon();
-
- bgnpolygon();
- n3f(oct_nnn);
- v3f(left);
- v3f(back);
- v3f(bottom);
- endpolygon();
- }
-
-
- /************************************************************
- DODECAHEDRON
- ************************************************************/
-
- /* unique vertices of the dodecahedron */
- static vector dodecdata[] =
- {
- {-0.7310437803862881,-0.5818932866609501,-0.3563357884039183 },
- {-0.9866414845543432,-0.113148838743958 , 0.1172003466176425 },
- {-0.8315553684216557, 0.543115689197534 ,-0.116365877286309 },
- {-0.4801091733003869, 0.4799650251592924,-0.7342538773044778 },
- {-0.4179895956313016,-0.2153287595699611,-0.8825634386524534 },
- { 0.2300325072865204, 0.9726753463107327, 0.03142795365232666},
- { 0.1759882159320658, 0.7454474934509961,-0.6429122664568439 },
- {-0.3926636729909752, 0.8476274142770002, 0.3568515188132501 },
- { 0.6435982800768732, 0.214230897543234 ,-0.7347696077138133 },
- { 0.2764998039674345,-0.3795614824074853,-0.8828821775744499 },
- { 0.3926636729909749,-0.8476274142770016,-0.3568515188132467 },
- {-0.2300325072865201,-0.9726753463107329,-0.03142795365232794},
- {-0.1759882159320652,-0.7454474934509932, 0.6429122664568472 },
- {-0.6435982800768731,-0.2142308975432367, 0.7347696077138126 },
- {-0.2764998039674331, 0.3795614824074883, 0.882882177574449 },
- { 0.4801091733003879,-0.479965025159286 , 0.7342538773044812 },
- { 0.4179895956313024, 0.2153287595699666, 0.8825634386524518 },
- { 0.8315553684216548,-0.5431156891975345, 0.1163658772863122 },
- { 0.9866414845543432, 0.1131488387439548,-0.1172003466176457 },
- { 0.7310437803862896, 0.5818932866609513, 0.3563357884039132 },
- };
-
-
- /* vertex indices for each facet of the dodecahedron */
- static int dodecfacets[][5] =
- {
- { 0 , 1 , 2 , 3 , 4 },
- { 5 , 6 , 3 , 2 , 7 },
- { 8 , 9 , 4 , 3 , 6 },
- { 10 , 11 , 0 , 4 , 9 },
- { 12 , 13 , 1 , 0 , 11 },
- { 14 , 7 , 2 , 1 , 13 },
- { 13 , 12 , 15 , 16 , 14 },
- { 11 , 10 , 17 , 15 , 12 },
- { 9 , 8 , 18 , 17 , 10 },
- { 6 , 5 , 19 , 18 , 8 },
- { 7 , 14 , 16 , 19 , 5 },
- { 19 , 16 , 15 , 17 , 18 }
- };
-
-
- /* wireframe dodecahedron */
- void wdodeca(void)
- {
-
- int facet;
- int vertex;
-
- for (facet=0; facet < 12; facet++)
- {
- bgnclosedline();
- for (vertex = 0; vertex < 5; vertex++)
- v3f(dodecdata[dodecfacets[facet][vertex]]);
- endclosedline();
- }
- }
-
-
- /* filled dodecahedron */
- void fdodeca(void)
- {
- int facet, vertex, c;
- static vector norm[12];
- static Boolean normals_initialized = FALSE;
-
- /* compute the facet normal as the average of the vertex normals */
- if (! normals_initialized)
- {
- for (facet = 0; facet < 12; facet++)
- {
- norm[facet][0] = norm[facet][1] = norm[facet][2] = 0.0;
-
- for (vertex = 0; vertex < 5; vertex++)
- for (c = 0; c < 3; c++)
- norm[facet][c] += dodecdata[dodecfacets[facet][vertex]][c];
-
- norm[facet][0] /= 5.0;
- norm[facet][1] /= 5.0;
- norm[facet][2] /= 5.0;
- }
-
- normals_initialized = TRUE;
- }
-
- for (facet = 0; facet < 12; facet++)
- {
- bgnpolygon();
- n3f(norm[facet]);
- for (vertex = 0; vertex < 5; vertex++)
- v3f(dodecdata[dodecfacets[facet][vertex]]);
- endpolygon();
- }
- }
-
-
- /************************************************************
- ICOSAHEDRON
- ************************************************************/
-
- /* unique vertices of the icosahedron */
- static float icosadata[][3] =
- {
- { 0.000000, 0.000000, -1.000000},
- { 0.000000, 0.894427, -0.447214},
- { 0.850651, 0.276393, -0.447214},
- { 0.525731, -0.723607, -0.447214},
- {-0.525731, -0.723607, -0.447214},
- {-0.850651, 0.276393, -0.447214},
- { 0.525731, 0.723607, 0.447214},
- { 0.850651, -0.276393, 0.447214},
- { 0.000000, -0.894427, 0.447214},
- {-0.850651, -0.276393, 0.447214},
- {-0.525731, 0.723607, 0.447214},
- { 0.000000, 0.000000, 1.000000}
- };
-
- /* vertex indices for each facet of the icosahedron */
- static int icosafacets[][3] =
- {
- 1, 2, 0,
- 2, 3, 0,
- 3, 4, 0,
- 4, 5, 0,
- 5, 1, 0,
- 10, 6, 1,
- 6, 2, 1,
- 6, 7, 2,
- 7, 3, 2,
- 7, 8, 3,
- 8, 4, 3,
- 8, 9, 4,
- 9, 5, 4,
- 9,10, 5,
- 10, 1, 5,
- 11, 6,10,
- 11, 7, 6,
- 11, 8, 7,
- 11, 9, 8,
- 11,10, 9,
- };
-
-
- /* wireframe icosahedron */
- void wicosa(void)
- {
- int facet, vertex;
-
- for (facet = 0; facet < 20; facet++)
- {
- bgnclosedline();
- for (vertex = 0; vertex < 3; vertex++)
- v3f(icosadata[icosafacets[facet][vertex]]);
- endclosedline();
- }
- }
-
-
- /* filled icosahedron */
- void ficosa(void)
- {
- int facet, vertex, c;
- static vector norm[20];
- static Boolean normals_initialized = FALSE;
-
- /* compute the facet normal as the average of the vertex normals */
- if (! normals_initialized)
- {
- for (facet = 0; facet < 20; facet++)
- {
- norm[facet][0] = norm[facet][1] = norm[facet][2] = 0.0;
-
- for (vertex = 0; vertex < 3; vertex++)
- for (c = 0; c < 3; c++)
- norm[facet][c] += icosadata[icosafacets[facet][vertex]][c];
-
- norm[facet][0] /= 3.0;
- norm[facet][1] /= 3.0;
- norm[facet][2] /= 3.0;
- }
-
- normals_initialized = TRUE;
- }
-
- for (facet = 0; facet < 20; facet++)
- {
- bgnpolygon();
- n3f(norm[facet]);
- for (vertex = 0; vertex < 3; vertex++)
- v3f(icosadata[icosafacets[facet][vertex]]);
- endpolygon();
- }
- }
-
-
- /************************************************************
- CONE
- ************************************************************/
-
- /* number of facets around the cone */
- #define CONE_FACETS 30
-
- /* has the cone been initialized */
- static Boolean cone_initialized = FALSE;
-
- /* arrays for cone vertices and normals */
- static vector cone_point[CONE_FACETS];
- static vector cone_norm[CONE_FACETS];
-
-
- static void initcone(
- vector point[CONE_FACETS],
- vector norm[CONE_FACETS])
- {
- int i;
- int facets = CONE_FACETS;
- float theta,nx,ny,nz,l;
-
- for (i = 0; i < facets; i++)
- {
- theta = 2.0*M_PI*(float)i/(float)facets;
-
- point[i][0] = fcos(theta);
- point[i][1] = 0.0;
- point[i][2] = fsin(theta);
-
- nx = fcos(theta);
- ny = fcos(M_PI/4.0)*fsin(M_PI/4.0);
- nz = fsin(theta);
- l = fsqrt(nx*nx + ny*ny + nz*nz);
-
- norm[i][0] = nx/l;
- norm[i][1] = ny/l;
- norm[i][2] = nz/l;
- }
- }
-
-
- /*
- wireframe cone of radius 1.0 and height 1.0 with the origin at
- the center of the base
- */
- void wcone(void)
- {
- int i, facets = CONE_FACETS;
-
- if (! cone_initialized)
- {
- initcone(cone_point, cone_norm);
- cone_initialized = TRUE;
- }
-
- for (i = 0; i < facets-1; i++)
- {
- bgnclosedline();
- v3f(top);
- v3f(cone_point[i]);
- v3f(cone_point[(i+1)%facets]);
- endclosedline();
- }
- bgnclosedline();
- v3f(top);
- v3f(cone_point[facets - 1]);
- v3f(cone_point[0]);
- endclosedline();
- }
-
-
-
- /*
- filled cone of radius 1.0 and height 1.0 with the origin at
- the center of the base
- */
- void fcone(void)
- {
- int i, facets = CONE_FACETS;
- float top_norm[3];
-
- if (! cone_initialized)
- {
- initcone(cone_point, cone_norm);
- cone_initialized = TRUE;
- }
-
- bgntmesh();
- n3f(cone_norm[0]);
- v3f(cone_point[0]);
-
- for (i = 1; i <= facets; i++)
- {
- n3f(cone_norm[i%facets]);
- v3f(top);
- n3f(cone_norm[i%facets]);
- v3f(cone_point[i%facets]);
- }
- endtmesh();
- }
-
-
- /************************************************************
- CYLINDER
- ************************************************************/
-
- /* number of polygons around the cross section of the cylinder */
- #define CYL_NUMC 20
-
- /* number of polygons down the length of the cylinder */
- #define CYL_NUML 10
-
- /* arrays for torus vertices and normals */
- static vector cyl_point[CYL_NUMC][CYL_NUML+1];
- static vector cyl_norm[CYL_NUMC][CYL_NUML+1];
-
- /* has the cylinder been initialized */
- static Boolean cylinder_initialized = FALSE;
-
-
- /* initialize a cylinder */
- static void initcylinder(
- vector point[CYL_NUMC][CYL_NUML+1], /* array of vertex data */
- vector norm[CYL_NUMC][CYL_NUML+1]) /* array of normal data */
- {
- int i,j;
- float theta,nx,ny;
- int numc = CYL_NUMC, numl = CYL_NUML;
-
- for (i = 0; i < numc; i++)
- {
- theta = 2.0*M_PI*(float)i/(float)numc;
-
- nx = fcos(theta);
- ny = fsin(theta);
-
- for (j = 0; j <= numl; j++)
- {
- point[i][j][0] = nx;
- point[i][j][1] = ny;
- point[i][j][2] =(float)j/(float)numl - .5;
-
- norm[i][j][0] = nx;
- norm[i][j][1] = ny;
- norm[i][j][2] = 0.0;
- }
- }
- }
-
-
- /* wireframe cylinder */
- void wcylinder(void)
- {
- int i,j;
- int numc = CYL_NUMC, numl = CYL_NUML;
-
- if (! cylinder_initialized)
- {
- initcylinder(cyl_point,cyl_norm);
- cylinder_initialized = TRUE;
- }
-
- for (i = 0; i < numl; i++)
- for (j = 0; j < numc; j++)
- {
- bgnclosedline();
- v3f(cyl_point[j][i]);
- v3f(cyl_point[(j+1)%numc][i]);
- v3f(cyl_point[j][i+1]);
- endclosedline();
-
- bgnclosedline();
- v3f(cyl_point[(j+1)%numc][i]);
- v3f(cyl_point[j][i+1]);
- v3f(cyl_point[(j+1)%numc][i+1]);
- endclosedline();
- }
- }
-
-
- /* filled cylinder */
- void fcylinder(void)
- {
- int i,j;
- int numc = CYL_NUMC, numl = CYL_NUML;
-
- if (! cylinder_initialized)
- {
- initcylinder(cyl_point,cyl_norm);
- cylinder_initialized = TRUE;
- }
-
- for (i = 0; i < numc; i++)
- {
- bgntmesh();
- n3f(cyl_norm[i][0]);
- v3f(cyl_point[i][0]);
- for (j = 0; j < numl; j++)
- {
- n3f(cyl_norm[(i+1)%numc][j]);
- v3f(cyl_point[(i+1)%numc][j]);
- n3f(cyl_norm[i][j+1]);
- v3f(cyl_point[i][j+1]);
- }
- n3f(cyl_norm[(i+1)%numc][numl]);
- v3f(cyl_point[(i+1)%numc][numl]);
- endtmesh();
- }
- }
-
- /* filled, closed cylinder */
- void fclocylinder(void)
- {
- int i,j;
- int numc = CYL_NUMC, numl = CYL_NUML;
-
- if (! cylinder_initialized)
- {
- initcylinder(cyl_point,cyl_norm);
- cylinder_initialized = TRUE;
- }
-
- for (i = 0; i < numc; i++)
- {
- bgntmesh();
- n3f(cyl_norm[i][0]);
- v3f(cyl_point[i][0]);
- for (j = 0; j < numl; j++)
- {
- n3f(cyl_norm[(i+1)%numc][j]);
- v3f(cyl_point[(i+1)%numc][j]);
- n3f(cyl_norm[i][j+1]);
- v3f(cyl_point[i][j+1]);
- }
- n3f(cyl_norm[(i+1)%numc][numl]);
- v3f(cyl_point[(i+1)%numc][numl]);
- endtmesh();
- }
-
- bgntmesh();
- n3f(back);
- v3f(cyl_point[numc-1][0]);
- for (i = numc-2; i >= 0; i--)
- {
- v3f(cyl_point[i][0]);
- swaptmesh();
- }
- endtmesh();
-
- bgntmesh();
- n3f(front);
- v3f(cyl_point[0][numl]);
- for (i = 1; i < numc; i++)
- {
- v3f(cyl_point[i][numl]);
- swaptmesh();
- }
- endtmesh();
- }
-
-
- /************************************************************
- TORUS
- ************************************************************/
-
- /* number of polygons around the cross section of the torus */
- #define TORUS_NUMC 10
-
- /* number of polygons around the outside of the torus */
- #define TORUS_NUMT 20
-
- /* default torus cross sectional radius */
- #define TORUS_RAD_XC 0.3
-
- /* default torus radius */
- #define TORUS_RAD 1.0
-
- /* arrays for torus vertices and normals */
- static vector torus_point[TORUS_NUMC][TORUS_NUMT];
- static vector torus_norm[TORUS_NUMC][TORUS_NUMT];
-
- /* has the torus been initialized yet */
- static Boolean torus_initialized = FALSE;
-
-
- /* initalize data for a torus */
- static void inittorus(
- float rc, /* radius of the cross section */
- float rt, /* radius of the torus */
- vector point[TORUS_NUMC][TORUS_NUMT], /* array of vertices */
- vector norm[TORUS_NUMC][TORUS_NUMT]) /* array of normals */
- {
- int i, j;
- int numc = TORUS_NUMC, numt = TORUS_NUMT;
- float twopi, fi, fj, xc, yc, nx, ny, nz, n;
-
- twopi = 2.0 * M_PI;
-
- /* go around cross section */
- for (i = 0; i < numc; i++)
- {
- fi =(float) i;
-
- /* go around top view */
- for (j = 0; j < numt; j++)
- {
- fj =(float) j;
-
- point[i][j][0] = (rt + rc*fcos(twopi*fi/numc))*fcos(twopi*fj/numt);
- point[i][j][1] = (rt + rc*fcos(twopi*fi/numc))*fsin(twopi*fj/numt);
- point[i][j][2] = rc * fsin(twopi * fi/numc);
-
- xc = rt*fcos(twopi*fj/numt);
- yc = rt*fsin(twopi*fj/numt);
-
- nx = point[i][j][0] - xc;
- ny = point[i][j][1] - yc;
- nz = point[i][j][2];
-
- n = fsqrt(nx*nx + ny*ny + nz*nz);
-
- norm[i][j][0] = nx/n;
- norm[i][j][1] = ny/n;
- norm[i][j][2] = nz/n;
- }
- }
- }
-
-
- /* set the cross sectional and torus radius */
- void settorus(float rc, float rt)
- {
- inittorus(rc,rt,torus_point,torus_norm);
- torus_initialized = TRUE;
- }
-
-
- /* wireframe torus */
- void wtorus(void)
- {
- int i, j;
- int numc = TORUS_NUMC, numt = TORUS_NUMT;
-
- if (! torus_initialized)
- settorus(TORUS_RAD_XC,TORUS_RAD);
-
- for (i = 0; i < numc; i++)
- {
- for (j = 0; j < numt; j++)
- {
- bgnclosedline();
- v3f(torus_point[(i+1)%numc][j]);
- v3f(torus_point[i][j]);
- v3f(torus_point[(i+1)%numc][(j+1)%numt]);
- endclosedline();
-
- bgnclosedline();
- v3f(torus_point[i][j]);
- v3f(torus_point[(i+1)%numc][(j+1)%numt]);
- v3f(torus_point[i][(j+1)%numt]);
- endclosedline();
- }
- }
- }
-
-
- /* filled torus */
- void ftorus(void)
- {
- int i, j;
- int numc = TORUS_NUMC, numt = TORUS_NUMT;
-
- if (! torus_initialized)
- settorus(TORUS_RAD_XC,TORUS_RAD);
-
- for (i = 0; i < numc; i++)
- {
- bgntmesh();
- n3f(torus_norm[(i+1)%numc][0]);
- v3f(torus_point[(i+1)%numc][0]);
- for (j = 0; j < numt; j++)
- {
- n3f(torus_norm[i][j]);
- v3f(torus_point[i][j]);
- n3f(torus_norm[(i+1)%numc][(j+1)%numt]);
- v3f(torus_point[(i+1)%numc][(j+1)%numt]);
- }
- n3f(torus_norm[i][0]);
- v3f(torus_point[i][0]);
- endtmesh();
- }
- }
-
-
- /************************************************************
- SPHERE
- ************************************************************/
-
- /* how many levels of sphere tesselation */
- #define FILLED_SPHERE_TESSELATION 8
- #define WIRE_SPHERE_TESSELATION 4
-
-
- /* wireframe sphere */
- void wsphere(void)
- {
- /* radius, Tx, Ty, Tz */
- static float v[]={0.0,0.0,0.0,1.0};
-
- sphmode(SPH_TESS,SPH_ICOS);
- sphmode(SPH_DEPTH,WIRE_SPHERE_TESSELATION);
- sphmode(SPH_PRIM,SPH_LINE);
-
- sphdraw(v);
- }
-
-
- /* filled sphere */
- void fsphere(void)
- {
- /* radius, Tx, Ty, Tz */
- static float v[]={0.0,0.0,0.0,1.0};
-
- sphmode(SPH_TESS,SPH_ICOS);
- sphmode(SPH_DEPTH,FILLED_SPHERE_TESSELATION);
- sphmode(SPH_PRIM,SPH_MESH);
-
- sphdraw(v);
- }
-
- /* wireframe hemisphere */
- void whemisphere(void)
- {
- /* radius, Tx, Ty, Tz */
- static float v[]={0.0,0.0,0.0,1.0};
-
- sphmode(SPH_TESS,SPH_ICOS);
- sphmode(SPH_HEMI,TRUE);
- sphmode(SPH_DEPTH,WIRE_SPHERE_TESSELATION);
- sphmode(SPH_PRIM,SPH_LINE);
-
- sphdraw(v);
- sphmode(SPH_HEMI,FALSE);
- }
-
-
- /* filled hemisphere */
- void fhemisphere(void)
- {
- /* radius, Tx, Ty, Tz */
- static float v[]={0.0,0.0,0.0,1.0};
-
- sphmode(SPH_TESS,SPH_ICOS);
- sphmode(SPH_HEMI,TRUE);
- sphmode(SPH_DEPTH,FILLED_SPHERE_TESSELATION);
- sphmode(SPH_PRIM,SPH_MESH);
-
- sphdraw(v);
- sphmode(SPH_HEMI,FALSE);
- }
-
- /* sphere drawn with points */
- void psphere()
- {
- /* radius, Tx, Ty, Tz */
- static float v[]={0.0,0.0,0.0,1.0};
-
- sphmode(SPH_TESS,SPH_ICOS);
- sphmode(SPH_DEPTH,FILLED_SPHERE_TESSELATION);
- sphmode(SPH_PRIM,SPH_POINT);
-
- sphdraw(v);
- }
-
-
- /************************************************************
- AXES
- ************************************************************/
-
- /* draws a wireframe set of right-handed axes */
- void axes(void)
- {
- bgnline();
- v3f(center);
- v3f(right);
- endline();
- cmov(right[0],right[1],right[2]);
- charstr("X");
-
- bgnline();
- v3f(center);
- v3f(top);
- endline();
- cmov(top[0],top[1],top[2]);
- charstr("Y");
-
- bgnline();
- v3f(center);
- v3f(front);
- endline();
- cmov(front[0],front[1],front[2]);
- charstr("Z");
- }
-
-
- /************************************************************
- BEACHBALL
- ************************************************************/
-
- /* Number of colored stripes. Should be even to look right */
- #define BEACHBALL_STRIPES 12
-
- /* Default number of polygons making up a stripe. Should be even */
- #define BEACHBALL_POLYS 16
-
- /* array of vertices making up a stripe */
- static vector stripe_point[BEACHBALL_POLYS + 3];
-
- /* has the beachball been initialized */
- static Boolean beachball_initialized = FALSE;
-
- /* Number of polygons making up a stripe */
- static int beachball_stripes;
-
- /* Number of vertices making up a stripe */
- static int stripe_vertices;
-
- /*
- Initializes beachball_point array to be a stripe of unit radius.
- */
- void setbeachball(int stripes)
- {
- int i,j;
- float x,y,z; /* vertex points */
- float theta,delta_theta; /* angle from top pole to bottom pole */
- float offset; /* offset from center of stripe to vertex */
- float cross_radius; /* radius of cross section at current latitude */
- float cross_theta; /* angle occupied by a stripe */
-
- beachball_stripes = stripes;
-
- /* polys distributed by even angles from top to bottom */
- delta_theta = M_PI/((float)BEACHBALL_POLYS/2.0);
- theta = delta_theta;
-
- cross_theta = 2.0*M_PI/(float)beachball_stripes;
-
- j = 0;
-
- stripe_point[j][0] = top[0];
- stripe_point[j][1] = top[1];
- stripe_point[j][2] = top[2];
- j++;
-
- for (i = 0; i < BEACHBALL_POLYS; i += 2)
- {
- cross_radius = fsin(theta);
- offset = cross_radius * ftan(cross_theta/2.0);
-
- stripe_point[j][0] = - offset;
- stripe_point[j][1] = fcos(theta);
- stripe_point[j][2] = cross_radius;
- j++;
-
- stripe_point[j][0] = offset;
- stripe_point[j][1] = stripe_point[j-1][1];
- stripe_point[j][2] = stripe_point[j-1][2];
- j++;
-
- theta += delta_theta;
- }
-
- stripe_point[j][0] = bottom[0];
- stripe_point[j][1] = bottom[1];
- stripe_point[j][2] = bottom[2];
-
- stripe_vertices = j + 1;
-
- beachball_initialized = TRUE;
- }
-
- /*
- Draws a cononical beachball. The colors are cpack values when in RGBmode,
- colormap indices when in colormap mode.
- */
- void beachball(unsigned long c1, unsigned long c2)
- {
- long mode;
- float angle, delta_angle;
- int i,j;
-
-
- if (! beachball_initialized)
- setbeachball(BEACHBALL_STRIPES);
-
- mode = getdisplaymode();
-
- angle = 0.0;
- delta_angle = 360.0/(float)beachball_stripes;
-
- for (i = 0; i < beachball_stripes; i++)
- {
- switch(mode)
- {
- case DMSINGLE:
- case DMDOUBLE:
- if ( i%2 == 0)
- color(c1);
- else
- color(c2);
-
- break;
-
- case DMRGB:
- case DMRGBDOUBLE:
- if ( i%2 == 0)
- cpack(c1);
- else
- cpack(c2);
-
- break;
- }
-
- pushmatrix();
- rot(angle, 'y');
- angle += delta_angle;
-
- bgntmesh();
- for (j = 0; j < stripe_vertices; j++)
- v3f(stripe_point[j]);
- endtmesh();
- popmatrix();
- }
- }
-
-